package com.beiing.tianshuai.tianshuai.huodong.presenter;

import com.beiing.tianshuai.tianshuai.entity.CodeBean;
import com.beiing.tianshuai.tianshuai.entity.EventTypesBean;
import com.beiing.tianshuai.tianshuai.huodong.model.HuoDongPublishModel;
import com.beiing.tianshuai.tianshuai.huodong.model.IHuoDongPublishModel;
import com.beiing.tianshuai.tianshuai.huodong.view.IHuoDongPublishView;

import java.io.File;

import okhttp3.ResponseBody;

/**
 * Created by magikliu on 2017/10/22.
 */

public class HuoDongPublishPresenter implements IHuoDongPublishPresenter, HuoDongPublishModel.OnRequestResult {

    private IHuoDongPublishView mView;
    private IHuoDongPublishModel mModel;

    public HuoDongPublishPresenter(IHuoDongPublishView mView) {
        this.mView = mView;
        this.mModel = new HuoDongPublishModel(this);
    }

    @Override
    public void getHuoDongType() {
        mModel.getHuoDongType();
    }

    @Override
    public void uploadImg(File file) {
        mModel.getUploadImg(file);
    }

    @Override
    public void publishActive(String strech, int tid, int uid, String sponsor, String action_time, String exit_time, String location, String lessons, String cover, String content, String contact, String tel, float much, int count, String create_time, int is_three, String three_url) {
        mModel.publishActive(strech, tid, uid, sponsor, action_time, exit_time, location, lessons, cover, content, contact, tel, much, count, create_time, is_three, three_url);
    }

    @Override
    public void onGetTypeSuccess(EventTypesBean typeBean) {
        mView.getHuoDongType(typeBean);
    }

    @Override
    public void onUploadSuccess(ResponseBody responseBody) {
        mView.getUploadResult(responseBody);
    }

    @Override
    public void onPublishSuccess(CodeBean codeBean) {
        mView.publishActive(codeBean);
    }

    @Override
    public void onError(Throwable throwable) {

    }
}
